This is a deadlock.
The following is an example deadlock
threads:
"Thread-1": waiting to lock monitor 0x00000000062a6ce0 (object 0x00000000ec278078, a
org.apache.commons.pool.impl.GenericKeyedObjectPool), which is held by "Thread-0"
"Thread-0": waiting to lock monitor 0x00000000076790e8 (object 0x00000000ec280078, a
org.apache.commons.dbcp.PoolingConnection), which is held by "Thread-1"
Java stack information for the threads listed above:
===================================================
Thread-1:
at org.apache.commons.pool.impl.GenericKeyedObjectPool.borrowObject(GenericKeyedObjectPool.java:715)
- waiting to lock <0x00000000ec2b0070> (a org.apache.commons.pool.impl.GenericKeyedObjectPool)
at org.apache.commons.dbcp.PoolingConnection.prepareStatement(PoolingConnection.java:87)
- locked <0x00000000ec2a80d8> (a org.apache.commons.dbcp.PoolingConnection)
at Dbcp65$Thread2.run(Dbcp65.java:86)
Thread-0:
at org.apache.commons.dbcp.AbandonedTrace.addTrace(AbandonedTrace.java:173)
- waiting to lock <0x00000000ec2a80d8> (a org.apache.commons.dbcp.PoolingConnection)
at org.apache.commons.dbcp.PoolablePreparedStatement.activate(PoolablePreparedStatement.java:92)
at org.apache.commons.dbcp.PoolingConnection.activateObject(PoolingConnection.java:228)
at org.apache.commons.pool.impl.GenericKeyedObjectPool.evict(GenericKeyedObjectPool.java:991)
- locked <0x00000000ec2b0070> (a org.apache.commons.pool.impl.GenericKeyedObjectPool)
at Dbcp65$Thread1.run(Dbcp65.java:74)
More details about this bug are at DBCP-65 JIRA page.
This bug is reproduced under dbcp 1.2 and JDK 1.6_33.
Execute the following scripts to run the test to reproduce the bug (assume the location of the dbcp test project is dbcp_test_home).
Example:
Use monitor to report and terminate the program when deadlock happens:
${dbcp_test_home}/scripts/270.sh
Turn off monitor:
${dbcp_test_home}/scripts/270.sh
--monitoroff
| Option | Function |
| --monitoroff,-mo | Turn off to stop reporting bug messages and ending program
when test runs into the expected concurrency bug which is a deadlock. User has to terminate the program manually when this option is set. |